<?php
/**
 * Description of _recent_appt
 * 
 * @author trongkhoi
 * @since Sep 17, 2013 - 10:33:19 AM
 */
$prev_appoint = AptCustomer::getPrevAppt((isset($_GET['pk'])) ? $_GET['pk'] : "");
$next_appoint = AptCustomer::getNextAppt((isset($_GET['pk'])) ? $_GET['pk'] : "");
if ($prev_appoint != FALSE || $next_appoint != FALSE):
    ?>
    <div class="row-fluid">
        <div class="box span12">
            <div class="box-header">
                <h2><i class="icon-list-alt"></i>Recent Appointments</h2>
                <div class="box-icon">
                    <a href="#" class="btn-minimize"><i class="icon-chevron-up"></i></a>
                </div>
            </div>
            <div class="box-content">
                <div class="span6">
                    <?php if ($prev_appoint != FALSE): ?>
                        <?php $appt_prev = Appoint::model()->findByPk($prev_appoint['id']); ?>
                        <table class="table table-striped">
                            <tbody>
                                <tr>
                                    <td colspan="2">
                                        <a title="Go to Appointment" href="<?php echo $this->createUrl('appointment/index') ?>"><i><i class="icon-arrow-left"></i>&nbsp;Previous Appointment</i>
                                        </a></td>
                                </tr>
                                <tr>
                                    <td>Service</td>

                                    <td>
                                        <a target="_blank" href="<?php echo $appt_prev->service->editUrl ?>">
                                            <b><?php echo $appt_prev->service->s_name; ?></b>
                                        </a>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Time</td>
                                    <td>
                                        From <?php echo $appt_prev->start_time; ?> to <?php echo $appt_prev->end_time; ?>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Date</td>
                                    <td>
                                        <?php echo date('D, F dS, Y', $appt_prev->date); ?>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    <?php else: ?>
                        <div class="alert alert-block">
                            No previous Appointment.
                        </div>
                    <?php endif; ?>
                </div><!--/span-->
                <div class="span6">
                    <?php if ($next_appoint != FALSE): ?>
                        <?php $appt_next = Appoint::model()->findByPk($next_appoint['id']); ?>
                        <table class="table table-striped">
                            <tbody>
                                <tr>
                                    <td colspan="2">
                                        <a title="Go to Appointment" href="<?php echo $this->createUrl('appointment/index') ?>"><i>Next Appointment&nbsp;<i class="icon-arrow-right"></i></i>
                                        </a></td>
                                </tr>
                                <tr>
                                    <td>Service</td>
                                    <td>
                                        <a target="_blank" href="<?php echo $appt_next->service->editUrl ?>">
                                            <b><?php echo $appt_next->service->s_name; ?></b>
                                        </a>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Time</td>
                                    <td>
                                        From <?php echo $appt_next->start_time; ?> to <?php echo $appt_next->end_time; ?>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Date</td>
                                    <td>
                                        <?php echo date('D, F dS, Y', $appt_next->date); ?>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    <?php else: ?>
                        <div class="alert alert-block">
                            No next Appointment.
                        </div>
                    <?php endif; ?>
                </div><!--/span-->
            </div>
        </div>
    </div>
<?php endif; ?>